
<?php

class property_search_box
{
	protected	$_group = 1;
	protected	$_limit = 12;
	protected	$_role_id = 107;
	protected	$_DBconn;
	protected	$_front_template;
	protected	$_view;
	protected	$_business_type_db;
	protected	$_currency;
	protected	$_cat_Info;
	protected	$_mem_db;
	protected	$_country_db;
	protected	$translator;
	protected	$postValue;
	protected 	$_global_conf;
        protected 	$auth;
        protected 	$hasIdentity ;

	public function __construct($view) 
	{
		$this->_front_template = Zend_Registry::get('front_template'); 
		$this->_view =	$view;
		
		//DB Connection
		$this->_DBconn = Zend_Registry::get('msqli_connection');
		$this->_DBconn->getConnection();
		
		$this->translator  = Zend_Registry::get('translator');
		
		$frontController = Zend_Controller_Front::getInstance();		
		
		//DD Class
		$this->_global_conf 		= Zend_Registry::get('global_conf');
		$this->_currency 	= new Zend_Currency($this->_global_conf['default_locale']);
		$this->_business_type_db = new Property_Model_DbTable_BusinessType();
		$this->_cat_Info 	= new Property_Model_DbTable_Category();
		$this->_mem_db 		= new Members_Model_DbTable_MemberList();
		$this->_country_db 	= new Property_Model_DbTable_Country();
		$this->postValue 	= $frontController->getRequest()->getPost();
                
                
                
	}
	


  
	public function truncate($phrase,$start_words, $max_words)
	{
	   $phrase_array = explode(' ',$phrase);
	   if(count($phrase_array) > $max_words && $max_words > 0)
		  $phrase = implode(' ',array_slice($phrase_array, $start_words, $max_words)).'...';  
	   return $phrase;
	}
	
	public function class_body()
	{ 
                
		$version = Zend_Registry::get('version');
		$translator = Zend_Registry::get('translator');
		$property_db = new Property_Model_DbTable_Properties();	
                $bathrooms = $property_db->getNumberOfBathRooms();
		$bathrooms_max = $property_db->getNumberOfBathRooms('DESC');
		$country_info = $this->_country_db->getCountryName($this->_global_conf['default_country']);
          
                $select = $this->_DBconn->select()
									->from(array('up' => Zend_Registry::get('dbPrefix').'user_profile'), array('up.user_id','title' => 'up.title', 'firstName' => 'up.firstName', 'lastName' => 'up.lastName', 'companyName' => 'up.companyName', 'address' => 'up.address', 'phone' => 'up.phone', 'mobile' => 'up.mobile', 'fax' => 'up.fax'))
									->where('up.role_id = ?', $this->_role_id)
									->where('up.status = ?', '1')
									->group('up.user_id')
									->limit($this->limit)
									->joinLeft(array('pp' => Zend_Registry::get('dbPrefix').'property_page'), 'pp.property_owner = up.user_id', array('property_num' => 'COUNT(*)'));
	
		$view_datas =  $select->query()->fetchAll();
?>
<?php 
$front_template = Zend_Registry::get('front_template'); 
$this->translator = Zend_Registry::get('translator');
$global_conf = Zend_Registry::get('global_conf');
$auth = Zend_Auth::getInstance ();
$hasIdentity = $auth->hasIdentity ();
?>
<script type="text/javascript">	
$(function() {
		
	$( "#property_name_box" ).autocomplete({
			source: function( request, response ) {
				$.ajax({
					url: "<?php echo $this->_view->url( array('module'=> 'Property', 'controller' => 'frontend', 'action'     => 'searchname' ), 'adminrout',    true); ?>",
					type: 'POST',
					dataType: "json",
					data: {
						property_name: request.term
					},
					success: function( data ) {
						if(data.status == 'ok')
						{
							response( $.map( data.search_data, function( item ) {
								var property_primary_image	= item.property_primary_image;
								var property_image	= item.property_image;
								var img_arr = (property_primary_image)? property_primary_image.split(',') : property_image.split(',');
								var room = item.property_location.split('<br />');
								return {
									label: item.property_name,
									value: item.property_name,
									pic: '<img src="data/frontImages/property/property_image/'+img_arr[0]+'" width="25" height="20" />',
									room:item.property_room,
									owner:item.owner_name,
									location: room[1]
								}
							}));
						}
						else
						{
							response( $.map( data, function( item ) {
								return 
							}));
						}
					}
				});
			},
			minLength: 2,
			open: function() {
				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			},
			close: function() {
				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
			}
		})
		.data( "autocomplete" )._renderItem = function( ul, item ) {
			return $( "<li></li>" )
				.data( "item.autocomplete", item )
				.append( "<a>" + item.pic+ " " + item.label  + item.owner + " " + item.room +  "<?php echo "&nbsp;yrs"; ?></a>" )
				.appendTo( ul );
		};		
	
	$( "#post_code_box" ).autocomplete({
			source: function( request, response ) {
				$.ajax({
					url: "<?php echo $this->_view->url( array('module'=> 'Property', 'controller' => 'frontend', 'action'     => 'searchname' ), 'adminrout',    true) ?>",
					type: 'POST',
					dataType: "json",
					data: {
						post_code: request.term
					},
					success: function( data ) {
						if(data.status == 'ok')
						{
							response( $.map( data.search_data, function( item ) {
								var property_primary_image	= item.property_primary_image;
								var property_image	= item.property_image;
								var img_arr = (property_primary_image)? property_primary_image.split(',') : property_image.split(',');
								var room = item.property_location.split('<br />');
								return {
									label: item.property_name,
									value: item.post_code,
									pic: '<img src="data/frontImages/property/property_image/'+img_arr[0]+'" width="25" height="20" />',
									room:item.property_room,
									owner:item.owner_name,
									location: room[1]
								}
							}));
						}
						else
						{
							response( $.map( data, function( item ) {
								return 
							}));
						}
					}
				});
			},
			minLength: 1,
			open: function() {
				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			},
			close: function() {
				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
			}
		})
		.data( "autocomplete" )._renderItem = function( ul, item ) {
			return $( "<li></li>" )
				.data( "item.autocomplete", item )
				.append( "<a>" + item.pic+ " " + item.label  + item.owner + " <strong><?php echo $this->translator->translator('property_post_code'); ?> :</strong> "+ item.value + item.room + " "+item.location+"</a>" )
				.appendTo( ul );
		};
		
	$( "#property_price_box" ).autocomplete({
		source: function( request, response ) {
			$.ajax({
				url: "<?php echo $this->_view->url( array('module'=> 'Property', 'controller' => 'frontend', 'action'     => 'searchname' ), 'adminrout',    true) ?>",
				type: 'POST',
				dataType: "json",
				data: {
					property_price: request.term
				},
				success: function( data ) {
					if(data.status == 'ok')
					{
						response( $.map( data.search_data, function( item ) {
							var property_primary_image	= item.property_primary_image;
							var property_image	= item.property_image;
							var img_arr = (property_primary_image)? property_primary_image.split(',') : property_image.split(',');
							var room = item.property_location.split('<br />');
							return {
								label: item.property_name,
								value: item.price,
								pic: '<img src="data/frontImages/property/property_image/'+img_arr[0]+'" width="25" height="20" />',
								room:item.property_room,
								owner:item.owner_name,
								location: room[1]
							}
						}));
					}
					else
					{
						response( $.map( data, function( item ) {
							return 
						}));
					}
				}
			});
		},
		minLength: 1,
		open: function() {
			$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
		},
		close: function() {
			$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );				
		}
	})
	.data( "autocomplete" )._renderItem = function( ul, item ) {
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( "<a>" + item.pic+ " " + item.label  + item.owner + " <strong><?php echo $this->translator->translator('price'); ?> :</strong> "+ item.value + item.room + " "+item.location+"</a>" )
			.appendTo( ul );				
	};	
});

$(document).ready(function() {
	function stripslashes(str) 
	{
		str=str.replace(/\\'/g,'\'');
		str=str.replace(/\\"/g,'"');
		str=str.replace(/\\0/g,'\0');
		str=str.replace(/\\\\/g,'\\');
		return str;
	}
	$('select.country_id_box').change(function() {	
			if($('select.country_id_box option:selected').val() == 'any' || $('select.country_id_box option:selected').val() =='')
			{
				$('select.area_id_box').html('<option value="any"><?php echo $this->translator->translator("common_select_area"); ?></option>');	
				$('select.state_id_box').html('<option value="any"><?php echo $this->translator->translator("common_select_state"); ?></option>');
			}
			else
			{	
				$.ajax({
					  url: "<?php echo $this->_view->url( array('module' =>'Property','controller' => 'frontend', 'action'     => 'states' ), 'adminrout',    true) ?>",
					  type: 'POST',
					  data: { id: $('select.country_id_box option:selected').val() },
					  beforeSend: function(){						
								$('select.state_id_box').html('<option value="any"><?php echo $this->translator->translator("common_loading_language"); ?></option>');
								$('select.area_id_box').html('<option value="any"><?php echo $this->translator->translator("common_select_area"); ?></option>');			
								$('#state_id_box_err').html('<img src="application/layouts/scripts/<?php echo $this->_front_template['theme_folder']; ?>/images/loader/search.gif" border="0"/>');	
							 },
					  success: function(response){
						//alert(response);
						var json_arr = eval("("+response+")");
						var option = '<option value="any"><?php echo $this->translator->translator("common_select_state"); ?></option>';				
						if(json_arr.status == 'ok')
						{
							for(var i = 0;i<json_arr.states.length;i++)
							{
								option += '<option value="'+json_arr.states[i].state_id+'" >'+stripslashes(json_arr.states[i].state_name)+'</option>';
							}
							$('select.state_id_box').html(option);
						}
						else
						{
							$('select.state_id_box').html('<option value="any">'+json_arr.msg+'</option>');
						}
						$('#state_id_box_err').html('');
					  }
				});
			}
		});
		
	$('select.state_id_box').change(function() {		
				
		if($('select.state_id_box option:selected').val() == 'any' || $('select.state_id_box option:selected').val() == '')
		{
			$('select.area_id_box').html('<option value="any"><?php echo $this->translator->translator("common_select_area"); ?></option>');
		}
		else
		{
			$.ajax({
				  url: "<?php echo $this->_view->url( array('module' => 'Property', 'controller' => 'frontend', 'action'     => 'areas' ), 'adminrout',    true) ?>",
				  type: 'POST',
				  data: { id: $('select.state_id_box option:selected').val() },
				  beforeSend: function(){						
						$('select.area_id_box').html('<option value="any"><?php echo $this->translator->translator("common_loading_language"); ?></option>');
						$('#area_id_box_err').html('<img src="application/layouts/scripts/<?php echo $this->_front_template['theme_folder']; ?>/images/loader/search.gif" border="0" />');	
						},
				  success: function(response){
					//alert(response);
					var json_arr = eval("("+response+")");
					var option = '<option value="any"><?php echo $this->translator->translator("common_select_area"); ?></option>';				
					if(json_arr.status == 'ok')
					{
						for(var i = 0;i<json_arr.cities.length;i++)
						{
							option += '<option value="'+json_arr.cities[i].city_id+'" >'+stripslashes(json_arr.cities[i].city)+'</option>';
						}
						$('select.area_id_box').html(option);
					}
					else
					{
						$('select.area_id_box').html('<option value="any">'+json_arr.msg+'</option>');
					}
					$('#area_id_box_err').html('');
				  }
			});
		}
	});	
	
	(function( $ ) {
		$.widget( "ui.combobox", {
			_create: function() {
				var self = this,
					select = this.element.hide(),
					selected = select.children( ":selected" ),
					value = selected.val() ? selected.text() : "";
				var input = $( "<input>" )
					.insertAfter( select )
					.val( value )
					.autocomplete({
						delay: 0,
						minLength: 0,
						source: function( request, response ) {
							var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
							response( select.children( "option" ).map(function() {
								var text = $( this ).text();
								if ( this.value && ( !request.term || matcher.test(text) ) )
									return {
										label: text.replace(
											new RegExp(
												"(?![^&;]+;)(?!<[^<>]*)(" +
												$.ui.autocomplete.escapeRegex(request.term) +
												")(?![^<>]*>)(?![^&;]+;)", "gi"
											), "<strong>$1</strong>" ),
										value: text,
										option: this
									};
							}) );
						},
						select: function( event, ui ) {
							ui.item.option.selected = true;
							self._trigger( "selected", event, {
								item: ui.item.option
							});
						},
						change: function( event, ui ) {
							if ( !ui.item ) {
								var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
									valid = false;
								select.children( "option" ).each(function() {
									if ( this.value.match( matcher ) ) {
										this.selected = valid = true;
										return false;
									}
								});
								if ( !valid ) {
									// remove invalid value, as it didn't match anything
									//alert($( this ).val());
									//$( this ).val( "" );
									//select.val( "" );
									select.append('<option value="'+$( this ).val()+'">'+$( this ).val()+'</option>');
									select.val( $( this ).val() );
									return false;
								}
							}
						}
					})
					.addClass( "ui-widget ui-widget-content ui-corner-left" );
	
				input.data( "autocomplete" )._renderItem = function( ul, item ) {
					return $( "<li></li>" )
						.data( "item.autocomplete", item )
						.append( "<a>" + item.label + "</a>" )
						.appendTo( ul );
				};
	
				$( "<span>&nbsp;</span>" )
					.attr( "tabIndex", -1 )
					.attr( "title", "Show All Items" )
					.insertAfter( input )
					.button({
						icons: {
							primary: "ui-icon-triangle-1-s"
						},
						text: false
					})
					.removeClass( "ui-corner-all" )
					.addClass( "ui-corner-right ui-button-icon" )
					.click(function() {
						// close if already visible
						if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
							input.autocomplete( "close" );
							return;
						}
	
						// pass empty string as value to search for, displaying all results
						input.autocomplete( "search", "" );
						input.focus();
					});
			}
		});
	})( jQuery );
});

$(function() {
	$( "#property_owner_box" ).combobox();		
});
</script>

<div class="block-search">
	<div class="block-content">
	<h2><?php echo $this->translator->translator('block_search_title','','', $this->_front_template['theme_folder']); ?></h2>
	<span class="slogan"><?php echo $this->translator->translator('block_search_slogan',$this->_view->escape($country_info['value']),'', $this->_front_template['theme_folder']); ?></span>
	<hr />
            
	<form action="<?php echo $this->_view->url( array('module' => 'Property', 'controller' => 'search', 'action'     => 'items' ), 'Search-Items',    true); ?>" method="post" name="propertySearchBox" id="propertySearchBox">
    	<input type="hidden" name="group_id_=" id="group_id" value="<?php echo $this->_group; ?>" /><input type="hidden" name="active_=" id="active" value="1" />   
		<p class="name"><?php echo $this->translator->translator('block_search_name','','', $this->_front_template['theme_folder']); ?></p>
        <input name="property_name_LIKE" id="property_name_box" type="text" class="name" value="<?php if(!empty($this->postValue['property_name_LIKE'])){ echo $this->postValue['property_name_LIKE']; }else{ echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); } ?>" />
      	                  
      	<!-- Feature Other Amenities to City of Work -->
          <div class="col clear">
        	<p><?php echo $this->translator->translator('block_search_other_amenities','','', $this->_front_template['theme_folder']); ?></p>
          	<select name="feature_other_amenities_LIKE" id="post_code_box" value="<?php if(!empty($this->postValue['feature_other_amenities_LIKE'])){ echo $this->postValue['feature_other_amenities_LIKE']; }else{ echo $this->translator->translator('block_search_jakarta','','', $this->_front_template['theme_folder']); } ?>">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <option value="jakarta"><?php echo $this->translator->translator('block_search_jakarta','','', $this->_front_template['theme_folder']); ?></option>
                <option value="surabaya"><?php echo $this->translator->translator('block_search_surabaya','','', $this->_front_template['theme_folder']); ?></option>
                <option value="medan"><?php echo $this->translator->translator('block_search_medan','','', $this->_front_template['theme_folder']); ?></option>
                <option value="bandung"><?php echo $this->translator->translator('block_search_bandung','','', $this->_front_template['theme_folder']); ?></option>
                <option value="semarang"><?php echo $this->translator->translator('block_search_semarang','','', $this->_front_template['theme_folder']); ?></option>
                <option value="ambon"><?php echo $this->translator->translator('block_search_ambon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="balikpapan"><?php echo $this->translator->translator('block_search_balikpapan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banda aceh"><?php echo $this->translator->translator('block_search_bandaaceh','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bandar lampung"><?php echo $this->translator->translator('block_search_bandarlampung','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjar"><?php echo $this->translator->translator('block_search_banjar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjar baru"><?php echo $this->translator->translator('block_search_banjarbaru','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjarmasin"><?php echo $this->translator->translator('block_search_banjarmasin','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="batam"><?php echo $this->translator->translator('block_search_batam','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="batu"><?php echo $this->translator->translator('block_search_batu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="baubau"><?php echo $this->translator->translator('block_search_baubau','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bekasi"><?php echo $this->translator->translator('block_search_bekasi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bengkulu"><?php echo $this->translator->translator('block_search_bengkulu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bima"><?php echo $this->translator->translator('block_search_bima','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="binjai"><?php echo $this->translator->translator('block_search_binjai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bitung"><?php echo $this->translator->translator('block_search_bitung','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="blitar"><?php echo $this->translator->translator('block_search_blitar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bogor"><?php echo $this->translator->translator('block_search_bogor','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bontang"><?php echo $this->translator->translator('block_search_bontang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bukittinggi"><?php echo $this->translator->translator('block_search_bukittinggi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cilegon"><?php echo $this->translator->translator('block_search_cilegon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cimahi"><?php echo $this->translator->translator('block_search_cimahi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cirebon"><?php echo $this->translator->translator('block_search_cirebon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="denpasar"><?php echo $this->translator->translator('block_search_denpasar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="depok"><?php echo $this->translator->translator('block_search_depok','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="dumai"><?php echo $this->translator->translator('block_search_dumai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="gorontalo"><?php echo $this->translator->translator('block_search_gorontalo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="gunung sitoli"><?php echo $this->translator->translator('block_search_gunungsitoli','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jambi"><?php echo $this->translator->translator('block_search_jambi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jayapura"><?php echo $this->translator->translator('block_search_jayapura','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kediri"><?php echo $this->translator->translator('block_search_kediri','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kendari"><?php echo $this->translator->translator('block_search_kendari','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kota klaten"><?php echo $this->translator->translator('block_search_kotaklaten','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kotamobagu"><?php echo $this->translator->translator('block_search_kotamobagu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kupang"><?php echo $this->translator->translator('block_search_kupang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="langsa"><?php echo $this->translator->translator('block_search_langsa','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="lhokseumawe"><?php echo $this->translator->translator('block_search_lhokseumawe','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="lubuklinggau"><?php echo $this->translator->translator('block_search_lubuklinggau','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="madiun"><?php echo $this->translator->translator('block_search_madiun','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="magelang"><?php echo $this->translator->translator('block_search_magelang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="makassar"><?php echo $this->translator->translator('block_search_makassar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="malang"><?php echo $this->translator->translator('block_search_malang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="manado"><?php echo $this->translator->translator('block_search_manado','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="mataram"><?php echo $this->translator->translator('block_search_mataram','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="metro"><?php echo $this->translator->translator('block_search_metro','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="mojokerto"><?php echo $this->translator->translator('block_search_mojokerto','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padang"><?php echo $this->translator->translator('block_search_padang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padang sidempuan"><?php echo $this->translator->translator('block_search_padangsidempuan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pagaralam"><?php echo $this->translator->translator('block_search_pagaralam','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palangkaraya"><?php echo $this->translator->translator('block_search_palangkaraya','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palembang"><?php echo $this->translator->translator('block_search_palembang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palopo"><?php echo $this->translator->translator('block_search_palopo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palu"><?php echo $this->translator->translator('block_search_palu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pangkalpinang"><?php echo $this->translator->translator('block_search_pangkalpinang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="parepare"><?php echo $this->translator->translator('block_search_parepare','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pasuruan"><?php echo $this->translator->translator('block_search_pasuruan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="payakumbuh"><?php echo $this->translator->translator('block_search_payakumbuh','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pakalongan"><?php echo $this->translator->translator('block_search_pakalongan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pekanbaru"><?php echo $this->translator->translator('block_search_pekanbaru','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pematangsiantar"><?php echo $this->translator->translator('block_search_pematangsiantar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pontianak"><?php echo $this->translator->translator('block_search_pontianak','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="prabumulih"><?php echo $this->translator->translator('block_search_prabumulih','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="probolinggo"><?php echo $this->translator->translator('block_search_probolinggo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="purwokerto"><?php echo $this->translator->translator('block_search_purwokerto','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="salatiga"><?php echo $this->translator->translator('block_search_salatiga','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="samarinda"><?php echo $this->translator->translator('block_search_samarinda','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="serang"><?php echo $this->translator->translator('block_search_serang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="singkawang"><?php echo $this->translator->translator('block_search_singkawang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sorong"><?php echo $this->translator->translator('block_search_sorong','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sukabumi"><?php echo $this->translator->translator('block_search_sukabumi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="surakarta"><?php echo $this->translator->translator('block_search_surakarta','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tangerang"><?php echo $this->translator->translator('block_search_tangerang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tangerang selatan"><?php echo $this->translator->translator('block_search_tangerangselatan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tanjungbalai"><?php echo $this->translator->translator('block_search_tanjungbalai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tanjungpinang"><?php echo $this->translator->translator('block_search_tanjungpinang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tarakan"><?php echo $this->translator->translator('block_search_tarakan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tasikmalaya"><?php echo $this->translator->translator('block_search_tasikmalaya','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tebingtinggi"><?php echo $this->translator->translator('block_search_tebingtinggi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tegal"><?php echo $this->translator->translator('block_search_tegal','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ternate"><?php echo $this->translator->translator('block_search_ternate','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="yogyakarta"><?php echo $this->translator->translator('block_search_yogyakarta','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="overseas"><?php echo $this->translator->translator('block_search_overseas','','', $this->_front_template['theme_folder']); ?></option>
     
         </select>
      	</div>
                <!--Type of Maid--->          
		<div class="col">
			<p><?php echo $this->translator->translator('block_search_type','','', $this->_front_template['theme_folder']); ?></p>                 
	  		<?php $type_info = $this->_business_type_db->getOptions($this->_group); ?>
      		<select name="property_type_=" id="property_type_box">
            	<option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
				<?php 
                    foreach($type_info as $info)
                    {
                        $selected = (!empty($this->postValue['property_type_=']) && $this->postValue['property_type_='] == $info['id']) ? ' selected="selected" ' : '';
                ?>
           		<option value="<?php echo $info['id']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($info['business_type']); ?></option>
            	<?php
                	}
            	?>
			</select>
		</div>
          
          <!--Category-->
          <div class="col">
			<p><?php echo $this->translator->translator('block_search_category','','', $this->_front_template['theme_folder']); ?></p>                   
			<?php $cat_data = $this->_cat_Info->getOptions($this->_group); ?>
            <select name="category_id_=" id="category_id_box">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                    foreach($cat_data as $info)
                    {
               		$selected = (!empty($this->postValue['category_id_=']) && $this->postValue['category_id_='] == $info['id']) ? ' selected="selected" ' : '';
                ?>
                <option value="<?php echo $info['id']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($info['category_name']); ?></option>
                <?php
                    }
                ?>
            </select> 
		</div>
                <div class="col">
			<input name="property_price_LIKE" id="property_price_box" value="<?php if(!empty($this->postValue['property_price_LIKE'])){ echo $this->postValue['property_price_LIKE']; }else{ echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); } ?>" type="hidden" size="20" />
           	
       	</div>
                          
		<div class="col">
			<p><?php echo $this->translator->translator('block_search_price_min','','', $this->_front_template['theme_folder']); ?></p>
			<?php $min_price_arr = $property_db->getPrice('ASC'); ?>
            <select name="property_price_>=" id="property_price_>=">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
				if($min_price_arr)
				{
					foreach($min_price_arr as $key=>$value)
					{
						if(!empty($value['property_price']))
						{
                        $selected = (!empty($this->postValue['property_price_>=']) && $this->postValue['property_price_>='] == $value['property_price']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_price']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_price']).' '.$currency; ?></option>
                <?php
                        }
                    }
				}
                ?>
            </select>  
		</div>
                          
                          
		<div class="col">
			<p><?php echo $this->translator->translator('block_search_price_max','','', $this->_front_template['theme_folder']); ?></p>
			<?php $max_price_arr = $property_db->getPrice('DESC'); ?>
            <select name="property_price_<=" id="property_price_<=">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
				if($max_price_arr)
				{
					foreach($max_price_arr as $key=>$value)
					{
						if(!empty($value['property_price']))
						{
                        $selected = (!empty($this->postValue['property_price_<=']) && $this->postValue['property_price_<='] == $value['property_price']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_price']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_price']).' '.$currency; ?></option>
                <?php
                        }
                    }
				}
                ?>
            </select>
		</div>
                          
		 <!-- Glazing to Education -->
               <div class="col">
                     <p><?php echo $this->translator->translator('block_search_glazing','','', $this->_front_template['theme_folder']); ?></p>
                <span class="ui-widget">
                  <select name="feature_glazing_=" id="">
                    <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="tidak_sekolah"><?php echo $this->translator->translator('block_search_glazing_no_school','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sd"><?php echo $this->translator->translator('block_search_glazing_sd','','', $this->_front_template['theme_folder']); ?></option>                              
                  <option value="smp"><?php echo $this->translator->translator('block_search_glazing_smp','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sma"><?php echo $this->translator->translator('block_search_glazing_sma','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="perguruan_tinggi"><?php echo $this->translator->translator('block_search_glazing_sarjana','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>             
               </div>
        
                       <!-- House name to Status -->
               <div class="col clear">
                     <p><?php echo $this->translator->translator('block_search_house_name','','', $this->_front_template['theme_folder']); ?></p>
                <span class="ui-widget">
                  <select name="house_name_=" id="">
                    <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="lajang"><?php echo $this->translator->translator('block_search_status_single','','', $this->_front_template['theme_folder']); ?></option>                              
                    <option value="menikah"><?php echo $this->translator->translator('block_search_status_married','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="Janda/Duda"><?php echo $this->translator->translator('block_search_status_widowed','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>             
               </div>

      	<!-- Tipology to Religion -->
               <div class="col">
                     <p><?php echo $this->translator->translator('block_search_tipology','','', $this->_front_template['theme_folder']); ?></p>
                <span class="ui-widget">
                  <select name="property_tipology_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="islam"><?php echo $this->translator->translator('block_search_tipology_muslim','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="budha"><?php echo $this->translator->translator('block_search_tipology_buddhist','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="katolik"><?php echo $this->translator->translator('block_search_tipology_catholic','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kristen"><?php echo $this->translator->translator('block_search_tipology_christian','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="hindu"><?php echo $this->translator->translator('block_search_tipology_hindu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="lainnya"><?php echo $this->translator->translator('block_search_tipology_other','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>               
               </div>                


              <!-- Dinning Space to Ethnic Origin -->           
               <div class="col">
                     <p><?php echo $this->translator->translator('block_search_dinning_space','','', $this->_front_template['theme_folder']); ?></p>
                <span class="ui-widget">
                  <select name="feature_dinning_space_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jawa"><?php echo $this->translator->translator('block_search_dinning_javanese','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sunda"><?php echo $this->translator->translator('block_search_dinning_sundanese','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padange"><?php echo $this->translator->translator('block_search_dinning_padangnese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="Tionghoa"><?php echo $this->translator->translator('block_search_dinning_chinese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="batak"><?php echo $this->translator->translator('block_search_dinning_batak','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="madura"><?php echo $this->translator->translator('block_search_dinning_madurese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="melayu"><?php echo $this->translator->translator('block_search_dinning_malay','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="lainnya"><?php echo $this->translator->translator('block_search_dinning_other','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>             
               </div>

                          
      	 <!-- Bathroom  Min to Age Min -->
           <div class="col clear">
			<p><?php echo $this->translator->translator('block_search_bathroom_min','','', $this->_front_template['theme_folder']); ?></p>
			<?php $bathroom = $property_db->getNumberOfBathRooms('ASC'); ?>
            <select name="feature_bathroom_>=" id="feature_bathroom_>=" class="room">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($bathroom as $key=>$value)
                {
                    if(!empty($value['feature_bathroom']))
                    {
                        $selected = (!empty($this->postValue['feature_bathroom_>=']) && $this->postValue['feature_bathroom_>='] == $value['feature_bathroom']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['feature_bathroom']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['feature_bathroom']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>  
             </div>
       	
        <!-- Bathroom  Min to Age Max -->
           <div class="col">
			<p><?php echo $this->translator->translator('block_search_bathroom_max','','', $this->_front_template['theme_folder']); ?></p>
			<?php $bathroom = $property_db->getNumberOfBathRooms('DESC'); ?>
            <select name="feature_bathroom_<=" id="" class="room">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($bathroom as $key=>$value)
                {
                    if(!empty($value['feature_bathroom']))
                    {
                        $selected = (!empty($this->postValue['feature_bathroom_<=']) && $this->postValue['feature_bathroom_<='] == $value['feature_bathroom']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['feature_bathroom']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['feature_bathroom']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>  
             </div>

                          
		<div class="col last">
			<p><?php echo $this->translator->translator('block_search_owner','','', $this->_front_template['theme_folder']); ?></p>
           	<?php $mem_data = $this->_mem_db->getAllMembers(); ?>
            <span class="ui-widget">
           	<select name="property_owner_=" id="property_owner_box">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                     <?php
		if($hasIdentity)
		{

                foreach($view_datas as $entry)
                {
                    $selected = (!empty($this->postValue['property_owner_=']) && $this->postValue['property_owner_='] == $key) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $this->_view->escape($entry['user_id']); ?>"<?php echo $selected; ?><?php echo $selected; ?>><?php echo $this->_view->escape($entry['companyName']); ?></option>
                <?php
                    }
        }
                ?>
           
          	</select>
          	</span>
		</div>
        
        <div class="btn-container">
			<input type="submit" name="Submit" value="<?php echo $this->translator->translator('block_search_btn','','', $this->_front_template['theme_folder']); ?>" />
        </div>
	</form>
	</div>
</div>
             
<?php
	}
}
try
{
	$property_search_box_class = new property_search_box($this);
	$property_search_box_class->class_body();
}
catch(Exception $e)
{
	echo $e->getMessage();
}
?>